<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/08/0008
 * Time: 9:57
 */

namespace app\sports_admin\controller;


use think\Model;
use think\Request;
use app\sports_admin\model\OtherOperationLog as OtherOperationLogModel;
class OtherOperationLog extends Base
{
    protected $beforeActionList = [
        'isData'=>['only'=>'index,getinfolist'],
        'operationSelect'=>['index.getinfolist']
    ];
    /**
     * 访问数据首页
     */
    public function index()
    {
        return view('index');
    }
    /**
     * 获取访问数据
     * @param $page 第几页
     * @param $rows 每页显示的条数
     * @param $sort 要排序的字段
     * @param $sortOrder 升序/降序
     * @param $searchName 要检索的字段
     * @param $start 开始时间
     * @param $end 结束时间
     */
    public function getInfoList()
    {
        $params = Request::instance()->only(['page','rows','sort','sortOrder','searchName','start','end','access_type']);
        $page = intval($params['page']) ? intval($params['page']) : 1;
        $rows = intval($params['rows']) ? intval($params['rows']) : 15;
        $sort = trim($params['sort']) ? trim($params['sort']) : 'id';
        $sortOrder = trim($params['sortOrder']) ? trim($params['sortOrder']) : 'desc';
        $searchName = trim($params['searchName']);
        $start = trim($params['start']);
        $end = trim($params['end']);
        $accessType = $params['access_type'];
        return OtherOperationLogModel::getInfoList($page,$rows,$sort,$sortOrder,$searchName,$start,$end,$accessType);
    }
}